import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        name: 'Index',
        redirect: '/home', // 重定向:重新指向其它path,会改变网址
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        children: [{
            path: 'homaPage',
            name: 'HomaPage',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/HomaPage.vue'),
            meta: {
                title: '首页'
            }
        }, {
            path: 'classify',
            name: 'Classify',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Classify.vue'),
            meta: {
                title: '分类'
            }
        }, {
            path: 'surprise',
            name: 'Surprise',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Surprise.vue'),
            meta: {
                title: '京喜'
            }
        }, {
            path: 'shopCar',
            name: 'ShopCar',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/ShopCar.vue'),
            meta: {
                title: '购物车'
            }
        }, {
            path: 'mypage',
            name: 'Mypage',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Mypage.vue'),
            meta: {
                title: '我的'
            }
        }]
    },
    {
        path: '/about',
        name: 'About',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/About.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router